import React from 'react';
import {Row, Col, Input, Button} from 'antd';


class SubInfoContainer extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      name: '',
      comment: ''
    };
  }

  handleNameChange(e) {
    this.setState({
      name: e.target.value,
    });
  }

  handleCommentChange(e) {
    this.setState({
      comment: e.target.value,
    });
  }

  updateSub() {
    // var requstData = {
    //   "id": this.state.table.id,
    //   "remark": this.state.remark,
    //   "comment": this.state.comment
    // }
    // updateRemCom(requstData).then(function (res) {
    //   //更新成功后刷新List数据
    //   if (res.status == 200) {
    //     var listData = {
    //       "id": this.state.table.id,
    //       "comment": this.state.comment
    //     }
    //     this.props.commentSignal.dispatch(listData);
    //   } else {
    //     this.openNotificationWithIcon('error')
    //   }
    // }.bind(this));
  }

  render() {

    return (
      <div>
        <Row>
          <Col span={3} style={{textAlign: "right"}}>主题名称：</Col>
          <Col span={12}>
            <Input id="name" value={this.state.name} onChange={this.handleNameChange.bind(this)}/>
          </Col>
        </Row>
        <p></p>
        <Row>
          <Col span={3} style={{textAlign: "right"}}>主题说明：</Col>
          <Col span={12}>
            <Input id="comment" type="textarea" rows={4} value={this.state.comment}
                   onChange={this.handleCommentChange.bind(this)}/>
          </Col>
        </Row>
        <p></p>
        <Row>
          <Col span={1} offset={3}>
            <Button type="primary" onClick={this.updateSub.bind(this)}>保存</Button>
          </Col>
          <Col span={1} offset={1}>
            <Button>删除</Button>
          </Col>
        </Row>
      </div>
    );
  }
}

export default SubInfoContainer;

